home *** CD-ROM | disk | FTP | other *** search
- #include <Fonts.h>
- #include <Scrap.h>
-
- #include <Movies.h>
-
- extern void registerTestTranscoder(void);
-
- pascal Boolean filter(MovieController mc, short action, void *params, long refCon);
-
- void main(void)
- {
- OSErr err;
- StandardFileReply reply;
- SFTypeList types;
- Movie m;
- short resFref;
- WindowPtr w;
- Rect bounds;
- Boolean done = false;
- TimeValue time = 0;
- ComponentInstance mc;
- Rect maxBounds = {100, 100, 700, 700};
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- MaxApplZone();
-
- registerTestTranscoder();
-
- EnterMovies();
-
- types[0] = MovieFileType;
- StandardGetFilePreview(nil, 1, types, &reply);
- if (!reply.sfGood) return;
-
- SetRect(&bounds, 75, 75, 75+160,75+120);
- w = NewCWindow(nil, &bounds, reply.sfFile.name, false, 0, (WindowPtr)-1,
- true, 0);
- if (!w) return;
-
- SetPort(w);
-
- err = OpenMovieFile(&reply.sfFile, &resFref, fsRdPerm);
- if (err) return;
-
- err = NewMovieFromFile(&m, resFref, nil, (StringPtr)nil,
- newMovieActive, nil);
- if (err) return;
-
- CloseMovieFile(resFref);
-
- GetMovieBox(m, &bounds);
- OffsetRect(&bounds, -bounds.left, -bounds.top);
- SetMovieBox(m, &bounds);
-
- mc = NewMovieController(m, &bounds, mcTopLeftMovie);
- MCGetControllerBoundsRect(mc, &bounds);
- MCDoAction(mc, mcActionSetKeysEnabled, (void *)1);
- MCSetActionFilterWithRefCon(mc, filter, (long)w);
-
- MCDoAction(mc, mcActionSetGrowBoxBounds, &maxBounds);
- SizeWindow(w, bounds.right, bounds.bottom, false);
-
- ShowWindow(w);
-
- while (done == false) {
- EventRecord theEvent;
- TimeValue nextTime;
-
- GetNextEvent(everyEvent, &theEvent);
- if (MCIsPlayerEvent(mc, &theEvent))
- continue;
-
- switch (theEvent.what) {
- case mouseDown:
- {
- WindowPtr whichWindow;
- short part;
-
- part = FindWindow(theEvent.where, &whichWindow);
- switch (part) {
- case inGoAway: done = TrackGoAway(whichWindow, theEvent.where);
- break;
- case inDrag: DragAlignedWindow(whichWindow, theEvent.where,
- &qd.screenBits.bounds, nil, nil);
- break;
- }
- }
- break;
-
- case activateEvt:
- SetCursor(&qd.arrow);
- break;
-
- case updateEvt:
- BeginUpdate((WindowPtr)theEvent.message);
- EndUpdate((WindowPtr)theEvent.message);
- UpdateMovie(m);
- break;
- }
- }
- ZeroScrap();
- PutMovieOnScrap(m, 0);
- DisposeMovieController(mc);
- DisposeMovie(m);
- }
-
- pascal Boolean filter(MovieController mc, short action, void *params, long refCon)
- {
- if (action == mcActionControllerSizeChanged) {
- Rect bounds;
-
- MCGetControllerBoundsRect(mc, &bounds);
- SizeWindow((void *)refCon, bounds.right, bounds.bottom, false);
- }
-
- return false;
- }
-